<%@page import="net.vinote.smart.platform.service.dw.html.UIEvent"%>
<%@page import="net.vinote.smart.platform.service.awe.layout.easyui.Icon"%>
<%@page import="net.vinote.smart.platform.service.awe.layout.easyui.Button"%>
<%@page import="net.vinote.smart.platform.comm.PlatformConst"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!--机构树图列表 -->
<%@include file="/comm/tree_begin.jsp"%>
<%
		tree = treeUI.getTreeBySQLCode("OrgInfoTree");

		Button linkBtn = new Button(Button.BUTTON_TYPE_LINK);
		linkBtn.addContent("新增");
		linkBtn.setIcon(Icon.ADD);
		linkBtn.addEvent(UIEvent.ON_CLICK, "addLayoutCatalog()");
		out.print(linkBtn.getHtml());
		linkBtn.setIcon(Icon.DEL);
		linkBtn.setContent("删除");
		out.print(linkBtn.getHtml());
%>
<div style="padding: 1px 0px;"></div>
<div id="mm" class="easyui-menu" style="width: 120px;">
	<div onclick="append()" data-options="iconCls:'icon-add'">添加</div>
	<div onclick="removeit()" data-options="iconCls:'icon-remove'">移除</div>
	<div class="menu-sep"></div>
	<div onclick="expand()">展开</div>
	<div onclick="collapse()">收缩</div>
</div>
<script>
	$(function() {
		$('#OrgInfoTree').tree(
				{
					onClick : function(node) {
						var layoutid = node.attributes.layoutid;
					},
					onContextMenu: function(e,node){
		                e.preventDefault();
		                $(this).tree('select',node.target);
		                $('#mm').menu('show',{
		                    left: e.pageX,
		                    top: e.pageY
		                });
		            }
				});
		
	});
		function append(){
            var t = $('#OrgInfoTree');
            var node = t.tree('getSelected');
            t.tree('append', {
                parent: (node?node.target:null),
                data: [{
                    text: 'new item1'
                },{
                    text: 'new item2'
                }]
            });
        }
        function removeit(){
            var node = $('#OrgInfoTree').tree('getSelected');
            $('#OrgInfoTree').tree('remove', node.target);
        }
        function collapse(){
            var node = $('#OrgInfoTree').tree('getSelected');
            $('#OrgInfoTree').tree('collapse',node.target);
        }
        function expand(){
            var node = $('#OrgInfoTree').tree('getSelected');
            $('#OrgInfoTree').tree('expand',node.target);
        }
	
</script>
<%@include file="/comm/tree_end.jsp"%>
